//package com.game.network.message.web;
//
//import com.alibaba.fastjson.JSONObject;
//import com.game.framework.common.error.GameException;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.web.bind.annotation.ControllerAdvice;
//import org.springframework.web.bind.annotation.ExceptionHandler;
//import org.springframework.web.bind.annotation.ResponseBody;
//
///**
// *
// * GlobalExceptionCatch
// */
//@Slf4j
//@ControllerAdvice
//public class GlobalExceptionCatch {
//
//    @ResponseBody
//    @ExceptionHandler(value = Throwable.class)
//    public ResponseEntity<JSONObject> exceptionHandler(Throwable ex) {
//        ResponseEntity<JSONObject> response = null;
//
//        if (ex instanceof GameException) {
//            GameException gameError = (GameException) ex;
//            response = new ResponseEntity<>(gameError.getError());
//            log.error("服务器异常,{}", ex.getMessage());
//        } else {
//            response = new ResponseEntity<>(-1, "未知异常:" + ex.getMessage());
//            log.error("服务器未知异常,{}",ex.getClass().getName(), ex);
//        }
//        return response;
//    }
//
//}
